//
// Created by 吴锐 on 2022/3/1.
//

#include "iostream"
#include "vector"

using namespace std;

void printVector(vector<int>& v){
    for(vector<int>::iterator it = v.begin() ; it != v.end() ; it++){
        cout << *it << " ";
    }
    cout << endl;
}

void test01(){
    //交换前
    vector<int> v1;
    for(int i = 0 ; i < 10 ; i++){
        v1.push_back(i);
    }
    printVector(v1);

    vector<int> v2;
    for(int i = 10 ; i > 0 ; i--){
        v2.push_back(i);
    }
    printVector(v2);

    //交换两个容器
    v1.swap(v2);
    printVector(v1);
    printVector(v2);
}

int main(){
    test01();
    return 0;
}